package com.quanshu.exchange.ui.gui.profile.member;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.quanshu.exchange.R;
import com.quanshu.exchange.support.entity.MemberBindEntity;
import com.quanshu.exchange.support.utils.RxViewHelper;
import com.quanshu.exchange.ui.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

public class BindInfoDetailActivity extends BaseActivity {

    @BindView(R.id.back)
    LinearLayout back;
    @BindView(R.id.tv_bonus_num)
    TextView tvBonusNum;
    @BindView(R.id.tv_bind_time)
    TextView tvBindTime;
    @BindView(R.id.tv_account)
    TextView tvAccount;
    @BindView(R.id.tv_rate)
    TextView tvRate;
    @BindView(R.id.tv_order_num)
    TextView tvOrderNum;

    private MemberBindEntity memberBindEntity;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_member_bind_detail);
        ButterKnife.bind(this);
        initIntent();
        initView();
        initListener();
    }

    private void initIntent() {
        memberBindEntity = (MemberBindEntity) getIntent().getSerializableExtra("MemberBindEntity");
    }

    private void initView() {
        if (memberBindEntity != null) {
            tvBonusNum.setText(memberBindEntity.getSum_price() + "");
            tvBindTime.setText(memberBindEntity.getCreate_time());
            tvAccount.setText(memberBindEntity.getUsername());
            tvRate.setText(memberBindEntity.getChance());
            tvOrderNum.setText(memberBindEntity.getOrder_count() + "");
        }
    }

    private void initListener() {
        RxViewHelper.getInstance().clicks(back, aVoid -> finish());
    }
}
